﻿namespace FlyingEye.Models
{
    public class DefaultActionResult
    {
        public string? Message { get; set; }

        public bool IsSuccess { get; set; }

        public static DefaultActionResult GetFailureResult(string? message = null)
        {
            return new DefaultActionResult()
            {
                Message = message,
                IsSuccess = false
            };
        }

        public static DefaultActionResult GetSuccessResult(string? message = null)
        {
            return new DefaultActionResult()
            {
                Message = message,
                IsSuccess = true
            };
        }
    }

    public class DefaultActionResult<TResult> : DefaultActionResult
    {
        public TResult? Result { get; set; }

        public static DefaultActionResult<TResult> GetSuccessResult(TResult? result = default, string? message = "")
        {
            return new DefaultActionResult<TResult>()
            {
                IsSuccess = true,
                Message = message,
                Result = result
            };
        }

        public static DefaultActionResult<TResult> GetFailureResult(string? message = null, TResult? result = default)
        {
            return new DefaultActionResult<TResult>()
            {
                IsSuccess = false,
                Message = message,
                Result = result
            };
        }
    }
}
